using System;
using System.Data;
using THANHTUNGO.Portal.Components.UI;

namespace THANHTUNGO.Portal.Modules.NEWS.Controls
{
    public partial class Item : YAFPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataView dv;
                if (Request.QueryString["categoryid"] != null)
                {
                    dv = Components.Item.SelectBy_CategoryID(Int32.Parse(Request.QueryString["categoryid"])).Tables[0].DefaultView;
                    dlItem.DataSource = dv;
                }
                else
                {
                    dv = Components.Item.SelectBy_ModuleID(this.ModuleID).Tables[0].DefaultView;
                    dlItem.DataSource = dv;
                }

                dv.Sort = "CreationTime DESC";
                dlItem.DataBind();
            }
        }
    }
}